home *** CD-ROM | disk | FTP | other *** search
- #include "VCRplus.h"
-
- extern vcrInfo myVCR;
- extern long CODE_VALUE;
-
- Boolean validateEntry(short entryType)
- {
- unsigned long tempLong, tempLong2;
- Str32 scratch;
-
- if (entryType == DECODE)
- {
- SetDText(dlgCHANNEL,"\p");
- SetDText(dlgSTARTTIME,"\p");
- SetDText(dlgDURATION,"\p");
-
- GetDText(dlgPLUSCODE, scratch);
- StringToNum(scratch, &tempLong);
-
- if( (tempLong<1) || (tempLong>999999L) )
- { SetDText(19,"\pCannot process that VCR plus code (must be <= 6 digits)!"); return FALSE; }
-
- myVCR.code = tempLong;
- CODE_VALUE = KEY001;
- }
- else
- {
- SetDText(dlgPLUSCODE,"\p");
-
- GetDText(dlgCHANNEL, scratch);
- StringToNum(scratch, &tempLong);
-
- if( (tempLong<1) || (tempLong>48) )
- { SetDText(19,"\pInvalid channel number"); return FALSE; }
-
- myVCR.channel = tempLong;
-
- GetDText(dlgSTARTTIME, scratch);
- StringToNum(scratch, &tempLong);
-
- tempLong2 = tempLong % 100;
- if((tempLong2 != 0) && (tempLong2 != 30))
- { SetDText(19,"\pStart time must be on an hour or half hour!"); return FALSE; }
-
- if((tempLong < 0) || (tempLong > 2330))
- { SetDText(19,"\pStart time must be in format: 1800 for 6pm"); return FALSE; }
-
- myVCR.startTime = tempLong;
-
- GetDText(dlgDURATION, scratch);
- StringToNum(scratch, &tempLong);
-
- tempLong2 = tempLong % 30;
- if((tempLong2!=0) || (tempLong<30) || (tempLong>300))
- { SetDText(19,"\pSorry, I cant process that program length\n"); return FALSE; }
-
- myVCR.duration = tempLong;
- CODE_VALUE = KEY002;
- }
-
- GetDText(dlgMONTH, scratch);
- StringToNum(scratch, &tempLong);
-
- if ((tempLong>12) || (tempLong<1))
- { SetDText(19,"\pInvalid month (must be 1-12)"); return FALSE; }
-
- myVCR.month = tempLong;
-
- GetDText(dlgDAY, scratch);
- StringToNum(scratch, &tempLong);
-
- if((tempLong<1) || (tempLong>31) )
- { SetDText(19,"\pInvalid day (must be 1-31)"); return FALSE; }
-
- myVCR.day = tempLong;
-
- GetDText(dlgYEAR, scratch);
- StringToNum(scratch, &tempLong);
-
- myVCR.year = tempLong % 100;
-
- return TRUE;
- }
-